package com.genesis.yunnanji.adapter;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.genesis.yunnanji.R;
import com.genesis.yunnanji.bean.SupBean;
import com.genesis.yunnanji.config.GenesisApiConfig;
import com.lidroid.xutils.BitmapUtils;

import org.xutils.x;

import java.util.List;

/**
 * Created by Administrator on 2017/11/10.
 */

public class SupAdapter extends BaseQuickAdapter<SupBean.ResultBean.InfoBean, BaseViewHolder> {

    private Context context;

    public SupAdapter(Context context, @Nullable List<SupBean.ResultBean.InfoBean> data) {
        super(R.layout.layout_sup_item, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, SupBean.ResultBean.InfoBean item) {


        BitmapUtils bitmapUtils = new BitmapUtils(context);
        bitmapUtils.display((ImageView) helper.getView(R.id.iv_supitem_iv), GenesisApiConfig.PIC_HOST + item.getCover_img());
        helper.setText(R.id.tv_supitem_title, item.getTitle());
        helper.setText(R.id.tv_supitem_address, "商家地址：" + item.getAddress());
        helper.setText(R.id.tv_supitem_phone, "联系电话：" + item.getPhone());
    }
}
